﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SystemManage_AdminRegister : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.txt_MachineCode.Text = PublicFunction.GetMID();

            this.cb_SMS.Checked = PublicFunction.GetOptionsAsBoolean("SMS_ON", true);
            this.cb_Email.Checked = PublicFunction.GetOptionsAsBoolean("Email_ON", true);
            this.cb_OnLinePay.Checked = PublicFunction.GetOptionsAsBoolean("OnLinePay_ON", true);
            this.cb_OnlinePayOut.Checked = PublicFunction.GetOptionsAsBoolean("OnLinePayOut_ON", true);
            this.cb_BackUp.Checked = PublicFunction.GetOptionsAsBoolean("BackUpDataBase_ON", true);

            this.btnSave.Attributes.Add("onclick", "return confirm('" + System.Web.HttpUtility.HtmlEncode("您确信输入无误，并且立即保存吗？") + "');");
        }
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        isRequestLogin = true;
        RequestCompetences = Competences.BuildCompetencesList(Competences.Administrator);
        RequestLoginPage = "SystemManage/AdminRegister.aspx";

        base.OnInit(e);
    }

    #endregion

    protected void btnSave_Click(object sender, EventArgs e)
    {
        PublicFunction.SetOptions("SMS_ON", this.cb_SMS.Checked);
        PublicFunction.SetOptions("Email_ON", this.cb_Email.Checked);
        PublicFunction.SetOptions("OnLinePay_ON", this.cb_OnLinePay.Checked);
        PublicFunction.SetOptions("OnLinePayOut_ON", this.cb_OnlinePayOut.Checked);
        PublicFunction.SetOptions("BackUpDataBase_ON", this.cb_BackUp.Checked);

        PublicFunction.SetOptions("SN", this.txt_RegisterCode.Text.Trim());

        ShoveEL._Web.JavaScript.Alert(this.Page, "保存成功。");
    }
}
